import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        commodity[] arr= new commodity[3];
        /*
        commodity c1 = new commodity("S3412312","苹果",99.8,100);
        commodity c2 = new commodity("S3241312","香蕉",97.8,200);
        commodity c3 = new commodity("S3413432","西瓜",69.8,300);
        */
        Scanner in = new Scanner(System.in);
        for (int j = 0; j < arr.length; j++) {
            commodity c1 = new commodity();
            System.out.println("请录入商品信息:");
            System.out.print("ID:");
            c1.setId(in.next());
            System.out.print("name:");
            c1.setName(in.next());
            System.out.print("price:");
            c1.setPrice(in.nextDouble());
            System.out.print("inventory:");
            c1.setInventory(in.nextInt());
            arr[j] =c1;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println("ID:"+arr[i].getId()+"\tname:"+arr[i].getName()+
                    "\tprice:"+arr[i].getPrice()+"\tinventory:"+arr[i].getInventory());
        }
    }
}